//回文链表

class Solution {
public:
    bool isPalindrome(ListNode* head) {
      vector<int> arr;
      while(head != nullptr)
      {
          arr.push_back(head->val);
          head = head->next;
      }  
      int left = 0, right = arr.size() - 1;
      while(left < right)
      {
          if(arr[left] == arr[right])
          {
              left++;
              right--;
          }
          else return false; 
      }
      return true;  
    }
};


